Skip to content

[Build] Fix java macos#27271

Merged
tianleiwu merged 11 commits intomainfrom
tlwu/fix_java_macos
Feb 11, 2026
Merged

[Build] Fix java macos#27271
tianleiwu merged 11 commits intomainfrom
tlwu/fix_java_macos

Conversation

@tianleiwu
Copy link
Contributor

@tianleiwu tianleiwu commented Feb 6, 2026

Description

This PR restores Java support on macOS arm64 and fixes Jar testing failures on the new AcesShared pool.

Background

Commit 5ed340f7a51f3cbdb62577a874daf2b3f23d6a93 (#26252) moved macOS builds to a faster pool (AcesShared) which reduced build time by 85%, but this pool doesn't have JDK installed and ADO's JavaToolInstaller doesn't support macOS. As a result, Java binaries for macOS arm64 were temporarily removed.

Changes

  1. Enable Java Builds & Tests on macOS ARM64:
  • Install JDK 17: Added a script to install JDK 17 via Homebrew if missing on the agent.
  • Install Maven: Added a fallback to install Maven using curl (since wget is missing on macOS) and configured it to use the * dynamically resolved JAVA_HOME.
  • Pipeline Updates: Updated jar_package_testing.yml and final-jar-testing-linux.yml to run correctly on AcesShared.
  1. Fix C API Tests on macOS ARM64:
  • Pool Migration: Updated c-api-noopenmp-test-pipelines.yml to use AcesShared with the correct ImageOverride.
  • Template Enhancements: Updated nuget/templates/test_macos.yml to support dynamic AgentPool and PoolDemands.
  • Fix Missing Artifact: Modified mac-cpu-packaging-steps.yml to explicitly copy libcustom_op_library.dylib into the testdata folder of the artifact, resolving DllNotFoundException in EndToEndTests.

Motivation and Context

To ensure robust CI coverage for macOS ARM64 (Apple Silicon) for both Java and C APIs effectively using the efficient AcesShared pool.

Testing

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores Java native artifact generation and inclusion for macOS arm64 in the packaging pipeline, and updates Windows-side JAR assembly to incorporate the new macOS arm64 Java artifact.

Changes:

  • Install Temurin JDK 17 on macOS arm64 build agents via Homebrew and enable --build_java for the macOS arm64 build.
  • Publish a macOS arm64 Java native artifact and download it in the Windows JAR packaging stage.
  • Add onnxruntime-java-osx-arm64 to the JAR packaging platform list and extend unit tests accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml Installs JDK 17 on macOS arm64 agents and enables --build_java.
tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-steps.yml Adds Java native artifact packaging/publishing step for macOS.
tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml Downloads the new macOS arm64 Java artifact in the Windows JAR packaging stage.
tools/ci_build/github/windows/jar_packaging.py Includes macOS arm64 Java artifact in CPU JAR packaging inputs.
tools/ci_build/github/windows/jar_packaging_test.py Updates test fixture and assertions for macOS arm64 Java artifact handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tianleiwu tianleiwu enabled auto-merge (squash) February 10, 2026 18:24
@tianleiwu tianleiwu merged commit 16667b1 into main Feb 11, 2026
150 of 157 checks passed
@tianleiwu tianleiwu deleted the tlwu/fix_java_macos branch February 11, 2026 17:56
tianleiwu added a commit that referenced this pull request Feb 12, 2026
### Description

This PR restores Java support on macOS arm64 and fixes Jar testing
failures on the new AcesShared pool.

#### Background

Commit `5ed340f7a51f3cbdb62577a874daf2b3f23d6a93`
(#26252) moved macOS builds
to a faster pool (AcesShared) which reduced build time by 85%, but this
pool doesn't have JDK installed and ADO's `JavaToolInstaller` doesn't
support macOS. As a result, Java binaries for macOS arm64 were
temporarily removed.

#### Changes

1. Enable Java Builds & Tests on macOS ARM64:
* Install JDK 17: Added a script to install JDK 17 via Homebrew if
missing on the agent.
* Install Maven: Added a fallback to install Maven using curl (since
wget is missing on macOS) and configured it to use the * dynamically
resolved JAVA_HOME.
* Pipeline Updates: Updated jar_package_testing.yml and
final-jar-testing-linux.yml to run correctly on AcesShared.
2. Fix C API Tests on macOS ARM64:
* Pool Migration: Updated c-api-noopenmp-test-pipelines.yml to use
AcesShared with the correct ImageOverride.
* Template Enhancements: Updated nuget/templates/test_macos.yml to
support dynamic AgentPool and PoolDemands.
* Fix Missing Artifact: Modified mac-cpu-packaging-steps.yml to
explicitly copy libcustom_op_library.dylib into the testdata folder of
the artifact, resolving DllNotFoundException in EndToEndTests.

### Motivation and Context

To ensure robust CI coverage for macOS ARM64 (Apple Silicon) for both
Java and C APIs effectively using the efficient AcesShared pool.

### Testing

- Final_Jar_Testing_MacOS passed: 

https://dev.azure.com/aiinfra/Lotus/_build/results?buildId=1081961&view=logs&j=f1f8e11e-a9fa-53e5-cd29-3ba2c1988550&t=f4fafe98-de38-519c-0045-d220f6898d47
tianleiwu added a commit that referenced this pull request Feb 13, 2026
This cherry-picks the following commits for the 1.24.2 release:
- #27096
- #27077
- #26677
- #27238
- #27213
- #27256
- #27278
- #27275
- #27276
- #27216
- #27271
- #27299
- #27294
- #27266
- #27176
- #27126
- #27252

---------

Co-authored-by: Xiaofei Han <xiaofeihan@microsoft.com>
Co-authored-by: Jiajia Qin <jiajiaqin@microsoft.com>
Co-authored-by: Yulong Wang <7679871+fs-eire@users.noreply.github.com>
Co-authored-by: qti-monumeen <monumeen@qti.qualcomm.com>
Co-authored-by: Ankit Maheshkar <ankit.maheshkar@intel.com>
Co-authored-by: Eric Crawford <eric.r.crawford@intel.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: guschmue <22941064+guschmue@users.noreply.github.com>
Co-authored-by: Guenther Schmuelling <guschmue@microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: angelser <32746004+angelser@users.noreply.github.com>
Co-authored-by: Angela Serrano Brummett <angelser@microsoft.com>
Co-authored-by: Misha Chornyi <99709299+mc-nv@users.noreply.github.com>
Co-authored-by: hariharans29 <9969784+hariharans29@users.noreply.github.com>
Co-authored-by: eserscor <erscor@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Baiju Meswani <bmeswani@microsoft.com>
Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
Co-authored-by: Ti-Tai Wang <titaiwang@microsoft.com>
Co-authored-by: bmehta001 <bmehta001@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants